package com.BMS.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import org.springframework.format.annotation.DateTimeFormat;

import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.annotation.JSONField;

/**
 * 图书借阅记录实体类
 * @author lenovo
 *
 */
@Entity
@Table(name = "borrow")
public class Borrow {

	private int borrow_ID;  // 借阅记录ID
	
	private String reader_ID;  // 借阅读者ID
	
	private String manager_ID;  // 操作管理员ID
	
	private String book_ID;  // 借阅图书ID
	
	@JSONField(format="yyyy-MM-dd")
	@DateTimeFormat(pattern="yyyy-MM-dd")
	private Date borrow_date;  // 借阅日期
	
	public Borrow() {
		
	}

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "borrow_ID",unique=true,nullable=false,length=12)
	public int getBorrow_ID() {
		return borrow_ID;
	}

	public void setBorrow_ID(int borrow_ID) {
		this.borrow_ID = borrow_ID;
	}

	@Column(name="reader_ID",nullable=false,length=12)
	public String getReader_ID() {
		return reader_ID;
	}

	public void setReader_ID(String reader_ID) {
		this.reader_ID = reader_ID;
	}

	@Column(name="manager_ID",nullable=false,length=12)
	public String getManager_ID() {
		return manager_ID;
	}

	public void setManager_ID(String manager_ID) {
		this.manager_ID = manager_ID;
	}

	@Column(name="book_ID",nullable=false,length=12)
	public String getBook_ID() {
		return book_ID;
	}

	public void setBook_ID(String book_ID) {
		this.book_ID = book_ID;
	}

	@Column(name="borrow_date",nullable=false)
	public Date getBorrow_date() {
		return borrow_date;
	}

	public void setBorrow_date(Date borrow_date) {
		this.borrow_date = borrow_date;
	}
	
	@Override
	public String toString() {
		JSONObject obj = new JSONObject();
		return obj.toJSONString(this);
	}
}
